import system from "@/api/model/system";
export default {
	namespaced: true,
	state: {
		locale: localStorage.getItem("i18n") || "zh_CN",
		requestI18n: {},
	},
	mutations: {
		SET_LOCALE(state, locale) {
			state.locale = locale;
		},
		SET_REQUESTI18N(state, data) {
			state.requestI18n = data;
		},
	},
	getters: {
		GET_COUNTRY(state) {
			if (state.countrys.length > 0) {
				return state.countrys;
			} else {
				system.dic.type.get("country_ISO_3166").then((res) => {
					return res.data;
				});
			}
		},
	},
	actions: {
		setLocale({ commit }, local) {
			commit("SET_LOCALE", local);
		},
		setRequestI18n({ commit }, data) {
			commit("SET_REQUESTI18N", data);
		},
	},
	modules: {},
};
